package com.encryption.rpc.facade
{
	import com.encryption.controls.tip.TipShowManager;
	import com.encryption.rpc.RPCEvent;
	
	import mx.rpc.events.ResultEvent;

	public class RPCFacadeHelper
	{
		public function RPCFacadeHelper()
		{
		}
		
		public static function rpcHandle(event:RPCEvent, 
										 resultHandle:Function, message:String, faultHandle:Function=null):void
		{
			if(event.targetEvent is ResultEvent){
				var resultEvent:ResultEvent = event.targetEvent as ResultEvent;
				resultHandle.call(null, resultEvent);
			}else{
				if(faultHandle != null)
					faultHandle.call();
				TipShowManager.showMessageTip(message);
			}
		}
	}
}